package day14;

public class homework007 {
    public static void main(String[] args) {
        homework07 h=new homework07();
        Thread t1 = new Thread(() -> {
            while(true){
                try {
                    Thread.currentThread().sleep(1200);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                h.increment();
                System.out.println(h.getNum());
            }
        });
        Thread t2 = new Thread(() -> {
            while(true){
                try {
                    Thread.currentThread().sleep(500);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                h.increment();
                System.out.println(h.getNum());
            }
        });
        Thread t3 = new Thread(() -> {
            while(true){
                h.crement();
                System.out.println(h.getNum());
                try {
                    Thread.currentThread().sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        Thread t4 = new Thread(() -> {
            while(true){
                h.crement();
                System.out.println(h.getNum());
                try {
                    Thread.currentThread().sleep(600);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        t1.start();
        t2.start();
        t3.start();
        t4.start();
    }
}
